package com.april.pattern.structural.facade;

/**
 * @author April
 * @version V1.0.0
 * @date 2019/07/04 11:26
 * @description 对外暴露的礼物兑换服务
 */
public class GiftExchangeService {
    private QualifyService qualifyService = new QualifyService();
    private PointsPaymentService pointsPaymentService = new PointsPaymentService();
    private ShoppingService shippingService = new ShoppingService();

    public void giftExchange(PointsGift pointsGift) {
        if (qualifyService.isHaveAvaliable(pointsGift)) {
            //资格校验通过
            if (pointsPaymentService.pay(pointsGift)) {
                //如果支付积分成功
                String shippingOrderNo = shippingService.shipGift(pointsGift);
                System.out.println("物流系统下单成功,订单号是:" + shippingOrderNo);
            }
        }
    }
}
